package cn.itcast.bos.quartz;

import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import cn.itcast.bos.service.PromotionService;
import cn.itcast.bos.service.WayBillService;

public class PromotionJob implements Job {

	@Autowired
	PromotionService promotionService;
	
	@Autowired
	WayBillService wayBillService;
	
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		System.out.println("开始执行任务调度，判断如果数据库的失效时间小于当前时间，更新status的状态从1变成2："+new Date());
		promotionService.updateStatus(new Date());
		// 同时执行数据库的数据同步到索引库的操作
		wayBillService.syncIndex();
	}

	
}
